Learn R Programming

xdvir (version 0.2-0)

fontspec Package: LaTeX Package fontspec.

Description

Define a LaTeXPackage for the LaTeX fontspec package.

Usage

fontspecPackage(font=NULL, name=font, renderer=NULL, axes=NULL)

Value

A "LaTeXpackage" object.

Arguments

font

The name of a font to use as the main font. See details.

name

The name of the resulting package.

renderer

The name of the fontspec renderer to use. NULL uses the default.

axes

A named vector of variable font axis values, as accepted by grDevices::glyphFont().

Author

Paul Murrell

Details

This function creates a "LaTeXpackage" object that provides support for the LaTeX fontspec package.

The font argument provides some convenience for setting the main font to be used. The font can be the common name of a system font or a complete path to the font file.

For variable fonts, use renderer="harfbuzz" (and the "luahbtex" TeX engine).

For more complex situations, fontspec commands can be added to the LaTeX code that is sent to functions like author and grid.latex (see the Examples).

A predefined package, with no main font defined, is pre-registered under the name "fontspec".

Examples

Run this code
cat(author("test", packages="fontspec"), sep="\n")
cat(author("test", packages=fontspecPackage(font="Courier")), sep="\n")
tex <- "\\setmainfont{fontname.ttf}[Path=/path/to/font/]\ntest"
cat(author(tex, packages="fontspec"), sep="\n")

Run the code above in your browser using DataLab